﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ServiceModel.Channels;
using System.ServiceModel;
using Acando.Dynamics.CRM.Silverlight.Library.CrmSdk;
using Acando.Dynamics.CRM.Silverlight.Library.MetaSdk;
using System.Threading;

namespace Acando.Dynamics.CRM.Silverlight.Library.CrmSdk
{
    
}

namespace Acando.Dynamics.CRM.Silverlight.Library.Helper
{
    public class SoapClientFactory
    {
        //private static CrmServiceSoapClient CrmSdkClone = null;
        
        private SoapClientFactory()
        {  }

        //static SoapClientFactory()
        //{  }
        
       
        public static CrmServiceSoapClient CreateCrmInstanceSilver()
        {
            BasicHttpBinding binding = new BasicHttpBinding();
            binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            binding.MaxReceivedMessageSize = 99999999;
            
            EndpointAddress endPointCRM = new EndpointAddress(Config.CrmServiceUrl);


            return new CrmServiceSoapClient(binding, endPointCRM);
        }

        public static MetadataServiceSoapClient CreateMetaIntanceSilver()
        {
            BasicHttpBinding binding = new BasicHttpBinding();
            binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;           
            binding.MaxReceivedMessageSize = 99999999;

            EndpointAddress endPointCRM = new EndpointAddress(Config.MetaServiceUrl);

            return new MetadataServiceSoapClient(binding, endPointCRM);
        }
    }
}
